import { request } from '../utils'

export async function query (params) {
  return request('/attendance/query', {
    method: 'post',
    data: params
  })
}


export async function fromTo (from,to,tag) {
  return request('/attendance/in', {
    method: 'post',
    data: {from,to,tag}
  })
}
// function str2ab(str) {
//   var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
//   var bufView = new Uint16Array(buf);
//   for (var i=0, strLen=str.length; i < strLen; i++) {
//     bufView[i] = str.charCodeAt(i);
//   }
//   return buf;
// }


export function downloadExcel(data,info,callback){
  request('/attendance/output', {
    method: 'post',
    data: {data,info}
  }).then((data)=>{
    callback(data);
  })
  // console.log(data,info);
}
